Integrand size = 45, antiderivative size = 560 \[ \int (a+b \tan (e+f x))^m (c+d \tan (e+f x))^3 \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right ) \, dx=\frac {\left (b c (2+m) \left (b^2 d (B c+(A-C) d) (3+m) (4+m)-2 (b c-a d) (3 a C d-b (3 c C+B d (4+m)))\right )+d \left (b^3 \left (2 c (A-C) d+B \left (c^2-d^2\right )\right ) (2+m) (3+m) (4+m)-a \left (b^2 d (B c+(A-C) d) (3+m) (4+m)-2 (b c-a d) (3 a C d-b (3 c C+B d (4+m)))\right )\right )\right ) (a+b \tan (e+f x))^{1+m}}{b^4 f (1+m) (2+m) (3+m) (4+m)}+\frac {(A-i B-C) (c-i d)^3 \operatorname {Hypergeometric2F1}\left (1,1+m,2+m,\frac {a+b \tan (e+f x)}{a-i b}\right ) (a+b \tan (e+f x))^{1+m}}{2 (i a+b) f (1+m)}-\frac {(A+i B-C) (c+i d)^3 \operatorname {Hypergeometric2F1}\left (1,1+m,2+m,\frac {a+b \tan (e+f x)}{a+i b}\right ) (a+b \tan (e+f x))^{1+m}}{2 (i a-b) f (1+m)}+\frac {d \left (b^2 d (B c+(A-C) d) (3+m) (4+m)-2 (b c-a d) (3 a C d-b (3 c C+B d (4+m)))\right ) \tan (e+f x) (a+b \tan (e+f x))^{1+m}}{b^3 f (2+m) (3+m) (4+m)}-\frac {(3 a C d-b (3 c C+B d (4+m))) (a+b \tan (e+f x))^{1+m} (c+d \tan (e+f x))^2}{b^2 f (3+m) (4+m)}+\frac {C (a+b \tan (e+f x))^{1+m} (c+d \tan (e+f x))^3}{b f (4+m)} \]
[Out]
Time = 2.45 (sec) , antiderivative size = 551, normalized size of antiderivative = 0.98, number of steps used = 9, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.133, Rules used = {3728, 3718, 3711, 3620, 3618, 70} \[ \int (a+b \tan (e+f x))^m (c+d \tan (e+f x))^3 \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right ) \, dx=\frac {d \tan (e+f x) (a+b \tan (e+f x))^{m+1} \left (2 (b c-a d) (-3 a C d+b B d (m+4)+3 b c C)+b^2 d (m+3) (m+4) (d (A-C)+B c)\right )}{b^3 f (m+2) (m+3) (m+4)}+\frac {(a+b \tan (e+f x))^{m+1} \left (b c (m+2) \left (2 (b c-a d) (-3 a C d+b B d (m+4)+3 b c C)+b^2 d (m+3) (m+4) (d (A-C)+B c)\right )+d \left (b^3 (m+2) (m+3) (m+4) \left (2 c d (A-C)+B \left (c^2-d^2\right )\right )-a \left (2 (b c-a d) (-3 a C d+b B d (m+4)+3 b c C)+b^2 d (m+3) (m+4) (d (A-C)+B c)\right )\right )\right )}{b^4 f (m+1) (m+2) (m+3) (m+4)}+\frac {(c-i d)^3 (A-i B-C) (a+b \tan (e+f x))^{m+1} \operatorname {Hypergeometric2F1}\left (1,m+1,m+2,\frac {a+b \tan (e+f x)}{a-i b}\right )}{2 f (m+1) (b+i a)}-\frac {(c+i d)^3 (A+i B-C) (a+b \tan (e+f x))^{m+1} \operatorname {Hypergeometric2F1}\left (1,m+1,m+2,\frac {a+b \tan (e+f x)}{a+i b}\right )}{2 f (m+1) (-b+i a)}+\frac {(c+d \tan (e+f x))^2 (-3 a C d+b B d (m+4)+3 b c C) (a+b \tan (e+f x))^{m+1}}{b^2 f (m+3) (m+4)}+\frac {C (c+d \tan (e+f x))^3 (a+b \tan (e+f x))^{m+1}}{b f (m+4)} \]
[In]
[Out]
Rule 70
Rule 3618
Rule 3620
Rule 3711
Rule 3718
Rule 3728
Rubi steps \begin{align*} \text {integral}& = \frac {C (a+b \tan (e+f x))^{1+m} (c+d \tan (e+f x))^3}{b f (4+m)}+\frac {\int (a+b \tan (e+f x))^m (c+d \tan (e+f x))^2 \left (A b c (4+m)-C (3 a d+b c (1+m))+b (B c+(A-C) d) (4+m) \tan (e+f x)+(3 b c C-3 a C d+b B d (4+m)) \tan ^2(e+f x)\right ) \, dx}{b (4+m)} \\ & = \frac {(3 b c C-3 a C d+b B d (4+m)) (a+b \tan (e+f x))^{1+m} (c+d \tan (e+f x))^2}{b^2 f (3+m) (4+m)}+\frac {C (a+b \tan (e+f x))^{1+m} (c+d \tan (e+f x))^3}{b f (4+m)}+\frac {\int (a+b \tan (e+f x))^m (c+d \tan (e+f x)) \left (-((2 a d+b c (1+m)) (3 b c C-3 a C d+b B d (4+m)))+b c (3+m) (A b c (4+m)-C (3 a d+b c (1+m)))+b^2 \left (2 c (A-C) d+B \left (c^2-d^2\right )\right ) (3+m) (4+m) \tan (e+f x)+\left (b^2 d (B c+(A-C) d) (3+m) (4+m)+2 (b c-a d) (3 b c C-3 a C d+b B d (4+m))\right ) \tan ^2(e+f x)\right ) \, dx}{b^2 (3+m) (4+m)} \\ & = \frac {d \left (b^2 d (B c+(A-C) d) (3+m) (4+m)+2 (b c-a d) (3 b c C-3 a C d+b B d (4+m))\right ) \tan (e+f x) (a+b \tan (e+f x))^{1+m}}{b^3 f (2+m) (3+m) (4+m)}+\frac {(3 b c C-3 a C d+b B d (4+m)) (a+b \tan (e+f x))^{1+m} (c+d \tan (e+f x))^2}{b^2 f (3+m) (4+m)}+\frac {C (a+b \tan (e+f x))^{1+m} (c+d \tan (e+f x))^3}{b f (4+m)}-\frac {\int (a+b \tan (e+f x))^m \left (a d \left (b^2 d (B c+(A-C) d) (3+m) (4+m)+2 (b c-a d) (3 b c C-3 a C d+b B d (4+m))\right )+b c (2+m) ((2 a d+b c (1+m)) (3 b c C-3 a C d+b B d (4+m))-b c (3+m) (A b c (4+m)-C (3 a d+b c (1+m))))-b^3 \left ((A-C) d \left (3 c^2-d^2\right )+B \left (c^3-3 c d^2\right )\right ) (2+m) \left (12+7 m+m^2\right ) \tan (e+f x)-\left (b c (2+m) \left (b^2 d (B c+(A-C) d) (3+m) (4+m)+2 (b c-a d) (3 b c C-3 a C d+b B d (4+m))\right )+d \left (b^3 \left (2 c (A-C) d+B \left (c^2-d^2\right )\right ) (2+m) (3+m) (4+m)-a \left (b^2 d (B c+(A-C) d) (3+m) (4+m)+2 (b c-a d) (3 b c C-3 a C d+b B d (4+m))\right )\right )\right ) \tan ^2(e+f x)\right ) \, dx}{b^3 (2+m) (3+m) (4+m)} \\ & = \frac {\left (b c (2+m) \left (b^2 d (B c+(A-C) d) (3+m) (4+m)+2 (b c-a d) (3 b c C-3 a C d+b B d (4+m))\right )+d \left (b^3 \left (2 c (A-C) d+B \left (c^2-d^2\right )\right ) (2+m) (3+m) (4+m)-a \left (b^2 d (B c+(A-C) d) (3+m) (4+m)+2 (b c-a d) (3 b c C-3 a C d+b B d (4+m))\right )\right )\right ) (a+b \tan (e+f x))^{1+m}}{b^4 f (1+m) (2+m) (3+m) (4+m)}+\frac {d \left (b^2 d (B c+(A-C) d) (3+m) (4+m)+2 (b c-a d) (3 b c C-3 a C d+b B d (4+m))\right ) \tan (e+f x) (a+b \tan (e+f x))^{1+m}}{b^3 f (2+m) (3+m) (4+m)}+\frac {(3 b c C-3 a C d+b B d (4+m)) (a+b \tan (e+f x))^{1+m} (c+d \tan (e+f x))^2}{b^2 f (3+m) (4+m)}+\frac {C (a+b \tan (e+f x))^{1+m} (c+d \tan (e+f x))^3}{b f (4+m)}-\frac {\int (a+b \tan (e+f x))^m \left (-b^3 \left (A c^3-c^3 C-3 B c^2 d-3 A c d^2+3 c C d^2+B d^3\right ) (2+m) (3+m) (4+m)-b^3 \left ((A-C) d \left (3 c^2-d^2\right )+B \left (c^3-3 c d^2\right )\right ) (2+m) \left (12+7 m+m^2\right ) \tan (e+f x)\right ) \, dx}{b^3 (2+m) (3+m) (4+m)} \\ & = \frac {\left (b c (2+m) \left (b^2 d (B c+(A-C) d) (3+m) (4+m)+2 (b c-a d) (3 b c C-3 a C d+b B d (4+m))\right )+d \left (b^3 \left (2 c (A-C) d+B \left (c^2-d^2\right )\right ) (2+m) (3+m) (4+m)-a \left (b^2 d (B c+(A-C) d) (3+m) (4+m)+2 (b c-a d) (3 b c C-3 a C d+b B d (4+m))\right )\right )\right ) (a+b \tan (e+f x))^{1+m}}{b^4 f (1+m) (2+m) (3+m) (4+m)}+\frac {d \left (b^2 d (B c+(A-C) d) (3+m) (4+m)+2 (b c-a d) (3 b c C-3 a C d+b B d (4+m))\right ) \tan (e+f x) (a+b \tan (e+f x))^{1+m}}{b^3 f (2+m) (3+m) (4+m)}+\frac {(3 b c C-3 a C d+b B d (4+m)) (a+b \tan (e+f x))^{1+m} (c+d \tan (e+f x))^2}{b^2 f (3+m) (4+m)}+\frac {C (a+b \tan (e+f x))^{1+m} (c+d \tan (e+f x))^3}{b f (4+m)}+\frac {1}{2} \left ((A-i B-C) (c-i d)^3\right ) \int (1+i \tan (e+f x)) (a+b \tan (e+f x))^m \, dx+\frac {1}{2} \left ((A+i B-C) (c+i d)^3\right ) \int (1-i \tan (e+f x)) (a+b \tan (e+f x))^m \, dx \\ & = \frac {\left (b c (2+m) \left (b^2 d (B c+(A-C) d) (3+m) (4+m)+2 (b c-a d) (3 b c C-3 a C d+b B d (4+m))\right )+d \left (b^3 \left (2 c (A-C) d+B \left (c^2-d^2\right )\right ) (2+m) (3+m) (4+m)-a \left (b^2 d (B c+(A-C) d) (3+m) (4+m)+2 (b c-a d) (3 b c C-3 a C d+b B d (4+m))\right )\right )\right ) (a+b \tan (e+f x))^{1+m}}{b^4 f (1+m) (2+m) (3+m) (4+m)}+\frac {d \left (b^2 d (B c+(A-C) d) (3+m) (4+m)+2 (b c-a d) (3 b c C-3 a C d+b B d (4+m))\right ) \tan (e+f x) (a+b \tan (e+f x))^{1+m}}{b^3 f (2+m) (3+m) (4+m)}+\frac {(3 b c C-3 a C d+b B d (4+m)) (a+b \tan (e+f x))^{1+m} (c+d \tan (e+f x))^2}{b^2 f (3+m) (4+m)}+\frac {C (a+b \tan (e+f x))^{1+m} (c+d \tan (e+f x))^3}{b f (4+m)}+\frac {\left ((i A+B-i C) (c-i d)^3\right ) \text {Subst}\left (\int \frac {(a-i b x)^m}{-1+x} \, dx,x,i \tan (e+f x)\right )}{2 f}-\frac {\left (i (A+i B-C) (c+i d)^3\right ) \text {Subst}\left (\int \frac {(a+i b x)^m}{-1+x} \, dx,x,-i \tan (e+f x)\right )}{2 f} \\ & = \frac {\left (b c (2+m) \left (b^2 d (B c+(A-C) d) (3+m) (4+m)+2 (b c-a d) (3 b c C-3 a C d+b B d (4+m))\right )+d \left (b^3 \left (2 c (A-C) d+B \left (c^2-d^2\right )\right ) (2+m) (3+m) (4+m)-a \left (b^2 d (B c+(A-C) d) (3+m) (4+m)+2 (b c-a d) (3 b c C-3 a C d+b B d (4+m))\right )\right )\right ) (a+b \tan (e+f x))^{1+m}}{b^4 f (1+m) (2+m) (3+m) (4+m)}-\frac {(i A+B-i C) (c-i d)^3 \operatorname {Hypergeometric2F1}\left (1,1+m,2+m,\frac {a+b \tan (e+f x)}{a-i b}\right ) (a+b \tan (e+f x))^{1+m}}{2 (a-i b) f (1+m)}-\frac {(A+i B-C) (c+i d)^3 \operatorname {Hypergeometric2F1}\left (1,1+m,2+m,\frac {a+b \tan (e+f x)}{a+i b}\right ) (a+b \tan (e+f x))^{1+m}}{2 (i a-b) f (1+m)}+\frac {d \left (b^2 d (B c+(A-C) d) (3+m) (4+m)+2 (b c-a d) (3 b c C-3 a C d+b B d (4+m))\right ) \tan (e+f x) (a+b \tan (e+f x))^{1+m}}{b^3 f (2+m) (3+m) (4+m)}+\frac {(3 b c C-3 a C d+b B d (4+m)) (a+b \tan (e+f x))^{1+m} (c+d \tan (e+f x))^2}{b^2 f (3+m) (4+m)}+\frac {C (a+b \tan (e+f x))^{1+m} (c+d \tan (e+f x))^3}{b f (4+m)} \\ \end{align*}
Both result and optimal contain complex but leaf count is larger than twice the leaf count of optimal. \(1390\) vs. \(2(560)=1120\).
Time = 6.54 (sec) , antiderivative size = 1390, normalized size of antiderivative = 2.48 \[ \int (a+b \tan (e+f x))^m (c+d \tan (e+f x))^3 \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right ) \, dx=\frac {C (a+b \tan (e+f x))^{1+m} (c+d \tan (e+f x))^3}{b f (4+m)}+\frac {\frac {(3 b c C-3 a C d+b B d (4+m)) (a+b \tan (e+f x))^{1+m} (c+d \tan (e+f x))^2}{b f (3+m)}+\frac {\frac {d \left (b^2 d (B c+(A-C) d) (3+m) (4+m)+2 (b c-a d) (3 b c C-3 a C d+b B d (4+m))\right ) \tan (e+f x) (a+b \tan (e+f x))^{1+m}}{b f (2+m)}-\frac {\frac {\left (-b c (2+m) \left (b^2 d (B c+(A-C) d) (3+m) (4+m)+2 (b c-a d) (3 b c C-3 a C d+b B d (4+m))\right )+d \left (-b^3 \left (2 c (A-C) d+B \left (c^2-d^2\right )\right ) (2+m) (3+m) (4+m)+a \left (b^2 d (B c+(A-C) d) (3+m) (4+m)+2 (b c-a d) (3 b c C-3 a C d+b B d (4+m))\right )\right )\right ) (a+b \tan (e+f x))^{1+m}}{b f (1+m)}+\frac {i \left (a d \left (b^2 d (B c+(A-C) d) (3+m) (4+m)+2 (b c-a d) (3 b c C-3 a C d+b B d (4+m))\right )+b c (2+m) \left (b^2 d (B c+(A-C) d) (3+m) (4+m)+2 (b c-a d) (3 b c C-3 a C d+b B d (4+m))\right )-b c (2+m) (-((2 a d+b c (1+m)) (3 b c C-3 a C d+b B d (4+m)))+b c (3+m) (A b c (4+m)-C (3 a d+b c (1+m))))-d \left (-b^3 \left (2 c (A-C) d+B \left (c^2-d^2\right )\right ) (2+m) (3+m) (4+m)+a \left (b^2 d (B c+(A-C) d) (3+m) (4+m)+2 (b c-a d) (3 b c C-3 a C d+b B d (4+m))\right )\right )-i b (2+m) \left (b^2 c \left (2 c (A-C) d+B \left (c^2-d^2\right )\right ) (3+m) (4+m)-d \left (b^2 d (B c+(A-C) d) (3+m) (4+m)+2 (b c-a d) (3 b c C-3 a C d+b B d (4+m))\right )+d (-((2 a d+b c (1+m)) (3 b c C-3 a C d+b B d (4+m)))+b c (3+m) (A b c (4+m)-C (3 a d+b c (1+m))))\right )\right ) \operatorname {Hypergeometric2F1}\left (1,1+m,2+m,\frac {-i a-i b \tan (e+f x)}{-i a+b}\right ) (a+b \tan (e+f x))^{1+m}}{2 (a+i b) f (1+m)}-\frac {i \left (a d \left (b^2 d (B c+(A-C) d) (3+m) (4+m)+2 (b c-a d) (3 b c C-3 a C d+b B d (4+m))\right )+b c (2+m) \left (b^2 d (B c+(A-C) d) (3+m) (4+m)+2 (b c-a d) (3 b c C-3 a C d+b B d (4+m))\right )-b c (2+m) (-((2 a d+b c (1+m)) (3 b c C-3 a C d+b B d (4+m)))+b c (3+m) (A b c (4+m)-C (3 a d+b c (1+m))))-d \left (-b^3 \left (2 c (A-C) d+B \left (c^2-d^2\right )\right ) (2+m) (3+m) (4+m)+a \left (b^2 d (B c+(A-C) d) (3+m) (4+m)+2 (b c-a d) (3 b c C-3 a C d+b B d (4+m))\right )\right )+i b (2+m) \left (b^2 c \left (2 c (A-C) d+B \left (c^2-d^2\right )\right ) (3+m) (4+m)-d \left (b^2 d (B c+(A-C) d) (3+m) (4+m)+2 (b c-a d) (3 b c C-3 a C d+b B d (4+m))\right )+d (-((2 a d+b c (1+m)) (3 b c C-3 a C d+b B d (4+m)))+b c (3+m) (A b c (4+m)-C (3 a d+b c (1+m))))\right )\right ) \operatorname {Hypergeometric2F1}\left (1,1+m,2+m,-\frac {i a+i b \tan (e+f x)}{-i a-b}\right ) (a+b \tan (e+f x))^{1+m}}{2 (a-i b) f (1+m)}}{b (2+m)}}{b (3+m)}}{b (4+m)} \]
[In]
[Out]
\[\int \left (a +b \tan \left (f x +e \right )\right )^{m} \left (c +d \tan \left (f x +e \right )\right )^{3} \left (A +B \tan \left (f x +e \right )+C \tan \left (f x +e \right )^{2}\right )d x\]
[In]
[Out]
\[ \int (a+b \tan (e+f x))^m (c+d \tan (e+f x))^3 \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right ) \, dx=\int { {\left (C \tan \left (f x + e\right )^{2} + B \tan \left (f x + e\right ) + A\right )} {\left (d \tan \left (f x + e\right ) + c\right )}^{3} {\left (b \tan \left (f x + e\right ) + a\right )}^{m} \,d x } \]
[In]
[Out]
\[ \int (a+b \tan (e+f x))^m (c+d \tan (e+f x))^3 \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right ) \, dx=\int \left (a + b \tan {\left (e + f x \right )}\right )^{m} \left (c + d \tan {\left (e + f x \right )}\right )^{3} \left (A + B \tan {\left (e + f x \right )} + C \tan ^{2}{\left (e + f x \right )}\right )\, dx \]
[In]
[Out]
Timed out. \[ \int (a+b \tan (e+f x))^m (c+d \tan (e+f x))^3 \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right ) \, dx=\text {Timed out} \]
[In]
[Out]
\[ \int (a+b \tan (e+f x))^m (c+d \tan (e+f x))^3 \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right ) \, dx=\int { {\left (C \tan \left (f x + e\right )^{2} + B \tan \left (f x + e\right ) + A\right )} {\left (d \tan \left (f x + e\right ) + c\right )}^{3} {\left (b \tan \left (f x + e\right ) + a\right )}^{m} \,d x } \]
[In]
[Out]
Timed out. \[ \int (a+b \tan (e+f x))^m (c+d \tan (e+f x))^3 \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right ) \, dx=\int {\left (a+b\,\mathrm {tan}\left (e+f\,x\right )\right )}^m\,{\left (c+d\,\mathrm {tan}\left (e+f\,x\right )\right )}^3\,\left (C\,{\mathrm {tan}\left (e+f\,x\right )}^2+B\,\mathrm {tan}\left (e+f\,x\right )+A\right ) \,d x \]
[In]
[Out]